package com.huawei.appmarket.service.store.awk.card;

import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appgallery.horizontalcard.api.card.BaseHorizontalItemCard;
import java.util.List;
import o.cgz;
import o.chc;
import o.chy;
import o.epv;
import o.ewm.h;
import o.ewm.j;

public class CampaignListCard extends BaseHorizontalItemCard {
    private View ʻ;
    private CampaignCard ʼ;
    private View ʽ;
    private CampaignCard ˋ;
    private View ॱॱ;
    private CampaignCard ᐝ;

    public CampaignListCard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        this.ˋ = new CampaignCard(this.ʼॱ);
        View findViewById = view.findViewById(j.ⁱ);
        RelativeLayout relativeLayout = (RelativeLayout) findViewById.findViewById(j.ʳᐝ);
        LayoutParams layoutParams = (LayoutParams) relativeLayout.getLayoutParams();
        layoutParams.topMargin = 0;
        relativeLayout.setLayoutParams(layoutParams);
        this.ॱॱ = findViewById.findViewById(j.ॱꜞ);
        this.ˋ.ˏ(findViewById);
        this.ˋ.ॱ(4);
        this.ᐝ = new CampaignCard(this.ʼॱ);
        View findViewById2 = view.findViewById(j.ﹳॱ);
        this.ʻ = findViewById2.findViewById(j.ॱꜞ);
        this.ᐝ.ˏ(findViewById2);
        this.ᐝ.ॱ(4);
        this.ʼ = new CampaignCard(this.ʼॱ);
        findViewById = view.findViewById(j.ꜞॱ);
        relativeLayout = (RelativeLayout) findViewById.findViewById(j.ʳᐝ);
        layoutParams = (LayoutParams) relativeLayout.getLayoutParams();
        layoutParams.bottomMargin = 0;
        relativeLayout.setLayoutParams(layoutParams);
        this.ʽ = findViewById.findViewById(j.ॱꜞ);
        this.ʼ.ˏ(findViewById);
        this.ʼ.ॱ(4);
        ʽ(view);
        ʻ();
        return this;
    }

    private void ʻ() {
        ˉ().setLayoutParams(new LinearLayout.LayoutParams(epv.ˎ(this.ʼॱ, ॱॱ(), chc.ˋ()), -2));
    }

    private int ॱॱ() {
        return chc.ʿ();
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
    }

    public void ˋ(List<CardBean> list) {
        int size = list.size();
        for (int i = 0; i < size; i++) {
            ˊ(i, (CardBean) list.get(i));
        }
        switch (size - 1) {
            case 0:
                this.ॱॱ.setVisibility(4);
                this.ᐝ.ॱ(4);
                this.ʼ.ॱ(4);
                return;
            case 1:
                this.ʻ.setVisibility(4);
                this.ʼ.ॱ(4);
                return;
            case 2:
                this.ʽ.setVisibility(4);
                return;
            default:
                return;
        }
    }

    private void ˊ(int i, CardBean cardBean) {
        if (i == 0) {
            ˋ(cardBean);
        }
        if (1 == i) {
            ॱ(cardBean);
        }
        if (2 == i) {
            ˎ(cardBean);
        }
    }

    private void ˋ(CardBean cardBean) {
        this.ˋ.ˏ(cardBean);
        this.ˋ.ॱ(0);
    }

    private void ॱ(CardBean cardBean) {
        this.ᐝ.ˏ(cardBean);
        this.ᐝ.ॱ(0);
    }

    private void ˎ(CardBean cardBean) {
        this.ʼ.ˏ(cardBean);
        this.ʼ.ॱ(0);
    }

    public int ˊ() {
        return h.ˌˎ;
    }

    public int ˎ() {
        return h.ˌˎ;
    }

    public void ॱ(chy o_chy) {
        this.ˋ.ॱ(o_chy);
        this.ᐝ.ॱ(o_chy);
        this.ʼ.ॱ(o_chy);
    }
}
